home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / oobr / java-brows.el < prev    next >
Encoding:
Text File  |  1995-08-29  |  3.5 KB  |  110 lines

  1. ;;!emacs
  2. ;;
  3. ;; FILE:         java-brows.el
  4. ;; SUMMARY:      Java source code browser.
  5. ;; USAGE:        GNU Emacs Lisp Library
  6. ;; KEYWORDS:     java, oop, tools
  7. ;;
  8. ;; AUTHOR:       Bob Weiner
  9. ;; ORG:          Motorola Inc.
  10. ;;
  11. ;; ORIG-DATE:    01-Aug-95
  12. ;; LAST-MOD:     25-Aug-95 at 15:06:22 by Bob Weiner
  13. ;;
  14. ;; Copyright (C) 1995  Free Software Foundation, Inc.
  15. ;; See the file BR-COPY for license information.
  16. ;;
  17. ;; This file is part of the OO-Browser.
  18. ;;
  19. ;; DESCRIPTION:  
  20. ;;
  21. ;;    Use 'java-browse' to invoke the java OO-Browser.  Prefix arg prompts for
  22. ;;    name of Environment file.
  23. ;;
  24. ;; DESCRIP-END.
  25.  
  26. ;; ************************************************************************
  27. ;; Other required Elisp libraries
  28. ;; ************************************************************************
  29.  
  30. (mapcar 'require '(br-start br br-java-ft))
  31.  
  32. ;; Needed until java is integrated
  33. (defvar java-env-file br-env-default-file)
  34.  
  35. ;;; ************************************************************************
  36. ;;; Public functions
  37. ;;; ************************************************************************
  38.  
  39. ;;;###autoload
  40. (defun java-browse (&optional env-file no-ui)
  41.   "Invoke the Java OO-Browser.
  42. This allows browsing through Java library and system class hierarchies.  With
  43. an optional non-nil prefix argument ENV-FILE, prompt for Environment file to
  44. use.  Alternatively, a string value of ENV-FILE is used as the Environment
  45. file name.  See also the file \"br-help\"."
  46.   (interactive "P")
  47.   (let ((same-lang (equal br-lang-prefix java-lang-prefix)))
  48.     (if same-lang
  49.     nil
  50.       (if br-lang-prefix
  51.       (br-env-copy nil)) ;; Save other language Environment in memory
  52.       (setq br-lang-prefix java-lang-prefix
  53.         *br-save-wconfig* nil))
  54.     (let ((same-env (or (equal java-env-file env-file)
  55.             (and (null env-file)
  56.                  (or java-lib-search-dirs java-sys-search-dirs)))))
  57.       (cond
  58.       ;; Continue browsing an Environment
  59.     ((and same-env same-lang))
  60.     ((and same-env (not same-lang))
  61.      (progn (java-browse-setup) (br-env-copy t)))
  62.     ;;
  63.     ;; Create default Environment file specification if needed and none
  64.     ;; exists.
  65.     ;;
  66.     (t (progn (or env-file (file-exists-p java-env-file)
  67.               (br-env-create java-env-file java-lang-prefix))
  68.           (or env-file (setq env-file java-env-file))
  69.           ;;
  70.           ;; Start browsing a new Environment.
  71.           ;;
  72.           (java-browse-setup)
  73.           (setq *br-save-wconfig* nil
  74.             java-env-file (br-env-init env-file same-lang nil)
  75.             java-sys-search-dirs br-sys-search-dirs
  76.             java-lib-search-dirs br-lib-search-dirs)
  77.           )))))
  78.   (br-init)
  79.   (or no-ui (br-browse)))
  80.  
  81. ;; Don't filter Environment classes when listed.
  82. (fset 'java-class-list-filter 'identity)
  83.  
  84. (defun java-mode-setup ()
  85.   "Load best available java major mode and set 'br-lang-mode' to the function that invokes it."
  86.   (fset 'br-lang-mode
  87.     (cond ((or (featurep 'java-mode)
  88.            (load "java-mode" 'missing-ok 'nomessage))
  89.            'java-mode)
  90.           ((featurep 'cc-mode)
  91.            'c++-mode)
  92.           ((load "cc-mode" 'missing-ok 'nomessage)
  93.            (provide 'c++-mode))
  94.           (t (error "(java-mode-setup): Can't load major mode for Java code.")))))
  95.  
  96. ;;; ************************************************************************
  97. ;;; Internal functions
  98. ;;; ************************************************************************
  99.  
  100. (defun java-browse-setup ()
  101.   "Setup language-dependent functions for OO-Browser."
  102.   (br-setup-functions)
  103.   ;; Use this until an info function is implemented for the language.
  104.   (fmakunbound 'br-insert-class-info)
  105.   (fset 'br-store-class-info 'java-store-class-info)
  106.   (java-mode-setup)
  107.   (br-setup-constants))
  108.  
  109. (provide 'java-brows)
  110.